home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu328.dms / pu328.adf / TapeCover / src / TapeCover.c next >
C/C++ Source or Header  |  1987-06-04  |  18KB  |  648 lines

  1. /*
  2.    Auto: sys1:bin/cc -sa -ss -su -3 +D <path><file> +l 
  3.    Auto: sys1:bin/ln +cd <path><file>.o -lcl
  4.  */
  5. #include <exec/types.h>
  6. #include <intuition/intuition.h>
  7.  
  8.  
  9. #define FF 0x0c
  10. #define CR 0x0d
  11. #define ESC 0x1b
  12. #define CLEARMENU 10
  13. #define SAVEMENU 11
  14. #define QUITMENU 13
  15. #define SIDEAGAD 0x50
  16. #define SIDEBGAD 0x70
  17. #define PRINTGAD 0x42
  18. #define BACKGAD  0x43
  19. #define FORWARDGAD 0x44
  20. #define FFORWARDGAD 0x45
  21. #define DOLBYGAD    0x46
  22. #define REWINDGAD   0x47
  23. #define NEWGAD      0x48
  24. #define DELGAD      0x41
  25. #define CLOSED 0x32
  26. #define INTUITION_REV 33
  27. #define GRAPHICS_REV 33
  28. #include <dh2:aztec/progs/tapecover/tapecovergadg.c>
  29. #include <stdio.h>
  30. #include <libraries/dos.h>
  31. #include <libraries/dosextens.h>
  32. struct IntuitionBase *IntuitionBase = NULL;
  33. struct GfxBase *GfxBase = NULL;
  34. struct Window  *window1 = NULL;
  35. struct RastPort *rp;
  36. struct TL {
  37.        char aname[35];
  38.        char bname[35];
  39.        char ItemAName[12][35];
  40.        char ItemBName[12][35];
  41.        };
  42. struct TL TapeList[200];  
  43. int GadFlag = 0;
  44. short numtapes = 0, currtape = 0, down = 0, direction = 0;
  45. int whichpicked = 0;
  46.  
  47.  
  48.  
  49. VOID 
  50. cleanExit(wind, returnValue)
  51.     struct Window  *wind;
  52.     int             returnValue;
  53. {
  54.     
  55.     if (wind)
  56.        {
  57.         ClearMenuStrip(wind);
  58.     CloseWindow(wind);
  59.        }
  60.     if (GfxBase)
  61.     CloseLibrary((struct Library *) GfxBase);
  62.     if (IntuitionBase)
  63.     CloseLibrary((struct Library *) IntuitionBase);
  64.     exit(returnValue);
  65. }
  66.  
  67. VOID 
  68. OpenAll(VOID)
  69. {
  70.     FILE *fopen(), *hs;
  71.     int counter = 0, count2;
  72.     IntuitionBase = (struct IntuitionBase *)
  73.     OpenLibrary("intuition.library", INTUITION_REV);
  74.     if (IntuitionBase == NULL)
  75.     cleanExit(NULL, RETURN_WARN);
  76.     GfxBase = (struct GfxBase *)
  77.     OpenLibrary("graphics.library", GRAPHICS_REV);
  78.  
  79.     if (GfxBase == NULL)
  80.     cleanExit(NULL, RETURN_WARN);
  81.  
  82.     window1 = (struct Window *) OpenWindow(&NewWindowStructure1);
  83.     if (window1 == NULL)
  84.     cleanExit(NULL, RETURN_WARN);
  85.     rp = window1->RPort;
  86.     PrintIText (window1->RPort, &IntuiTextList1, 0, 0);
  87.     SetMenuStrip (window1, &MenuList1);
  88.     if ((hs = fopen("TapeCover.file", "r")) != NULL) {
  89.       while (feof(hs) ==0)
  90.       {
  91.     fgets(TapeList[counter].aname,100,hs);
  92.            TapeList[counter].aname[strlen(TapeList[counter].aname)-1] = '\0';
  93.         fgets(TapeList[counter].bname,100,hs);
  94.            TapeList[counter].bname[strlen(TapeList[counter].bname)-1] = '\0';
  95.         for (count2 = 0; count2 < 12; count2++) 
  96.         {
  97.            fgets(TapeList[counter].ItemAName[count2],100,hs);
  98.            TapeList[counter].ItemAName[count2][strlen(TapeList[counter].ItemAName[count2])-1] = '\0';
  99.            fgets(TapeList[counter].ItemBName[count2],100,hs);
  100.            TapeList[counter].ItemBName[count2][strlen(TapeList[counter].ItemBName[count2])-1] = '\0';
  101.         }
  102.         counter++;
  103.       }
  104.         numtapes = counter - 2;
  105.     fclose(hs);
  106.         
  107.     }
  108. }
  109.  
  110.  
  111. USHORT 
  112. handleIDCMP(struct Window * win)
  113. {
  114.    int i;
  115.     int             flag = 0;
  116.     struct IntuiMessage *message = NULL;
  117.     int             code;
  118.     USHORT          id;
  119.     UWORD           oldtop;
  120.     ULONG           class;
  121.     struct Gadget  *g;
  122.     while (message = (struct IntuiMessage *) GetMsg(win->UserPort)) {
  123.     class = message->Class;
  124.     code = message->Code;
  125.     g = (struct Gadget *) (message->IAddress);
  126.  
  127.     switch (class) {
  128.     case CLOSEWINDOW:
  129.         flag = CLOSED;
  130.         break;
  131.     case GADGETUP:
  132.         flag = g->GadgetID;
  133.             down = 0;
  134.             direction = 0;
  135.         break;
  136.         case GADGETDOWN:
  137.             flag = g->GadgetID;
  138.             down = 1;
  139.             break;
  140.         case MENUPICK:
  141.             flag = ITEMNUM(code)+10;
  142.             if (flag == QUITMENU)
  143.                 flag = CLOSED;
  144.             
  145.             break;
  146.           }
  147.         ReplyMsg((struct Message *) message);
  148.     }
  149.     return (flag);
  150. }
  151.  
  152. VOID PrintRoutine()
  153. {
  154.    FILE  *fopen(), *fp;
  155.    short counter, linecount;
  156.    char normal[10];
  157.    char condensed[10], halffeed[10];
  158.    char outstr[100];
  159.    char headera[10], headerb[10];
  160.    char dataline[50], databline[50]; 
  161.    char blankline[100];
  162.    fp = fopen("PRT:","w");
  163.    if (fp != 0)
  164.    {      blankline[0] = '\0';
  165.       strcpy   (blankline,"|                                                                 |\n\0");
  166.       halffeed[0] = ESC;
  167.       halffeed[1] = 'K';
  168.       halffeed[2] = '\0';
  169.       normal[0] = ESC;
  170.       normal[1] = '\0';
  171.       strcat (normal, "[0w\0");
  172.       condensed[0] = ESC;
  173.       condensed[1] = '\0';
  174.       strcat (condensed, "[4w\0");
  175.       outstr[0] = '\0';
  176.       strcat (outstr,condensed);
  177.       fputs (outstr,fp);
  178.       fputs ("\n-------------------------------------------------------------------\n\0",fp);
  179.       outstr[0] = '\0';
  180.       strcat (outstr,"| ");
  181.       strcat (outstr,sideaSInfo.Buffer);
  182.       for (counter = 0; counter < (32-strlen(sideaSInfo.Buffer)); counter++)
  183.          strcat (outstr, " \0");
  184.       strcat (outstr,sidebSInfo.Buffer); 
  185.       for (counter = 0; counter < (32-strlen(sidebSInfo.Buffer)); counter++)
  186.          strcat (outstr, " \0");
  187.       strcat (outstr,"|\n\0");
  188.       fputs (outstr,fp);
  189.       fputs (blankline,fp);
  190.       for (linecount = 1; linecount < 13; linecount++)
  191.       {       
  192.        outstr[0] = '\0';
  193.        strcat (outstr,"| \0");
  194.        switch (linecount)
  195.        {
  196.           case 1:
  197.             strcpy (headera," 1. \0");
  198.             strcpy (dataline,a1SInfo.Buffer);
  199.             strcpy (headerb," 1. \0");
  200.             strcpy (databline,b1SInfo.Buffer);
  201.            break;
  202.           case 2:
  203.             strcpy (headera," 2. \0");
  204.             strcpy (dataline,a2SInfo.Buffer);
  205.             strcpy (headerb," 2. \0");
  206.             strcpy (databline,b2SInfo.Buffer);
  207.            break;
  208.           case 3:
  209.             strcpy (headera," 3. \0");
  210.             strcpy (dataline,a3SInfo.Buffer);
  211.             strcpy (headerb," 3. \0");
  212.             strcpy (databline,b3SInfo.Buffer);
  213.            break;
  214.           case 4:
  215.             strcpy (headera," 4. \0");
  216.             strcpy (dataline,a4SInfo.Buffer);
  217.             strcpy (headerb," 4. \0");
  218.             strcpy (databline,b4SInfo.Buffer);
  219.            break;
  220.           case 5:
  221.             strcpy (headera," 5. \0");
  222.             strcpy (dataline,a5SInfo.Buffer);
  223.             strcpy (headerb," 5. \0");
  224.             strcpy (databline,b5SInfo.Buffer);
  225.            break;
  226.           case 6:
  227.             strcpy (headera," 6. \0");
  228.             strcpy (dataline,a6SInfo.Buffer);
  229.             strcpy (headerb," 6. \0");
  230.             strcpy (databline,b6SInfo.Buffer);
  231.            break;
  232.           case 7:
  233.             strcpy (headera," 7. \0");
  234.             strcpy (dataline,a7SInfo.Buffer);
  235.             strcpy (headerb," 7. \0");
  236.             strcpy (databline,b7SInfo.Buffer);
  237.            break;
  238.           case 8:
  239.             strcpy (headera," 8. \0");
  240.             strcpy (dataline,a8SInfo.Buffer);
  241.             strcpy (headerb," 8. \0");
  242.             strcpy (databline,b8SInfo.Buffer);
  243.            break;
  244.           case 9:
  245.             strcpy (headera," 9. \0");
  246.             strcpy (dataline,a9SInfo.Buffer);
  247.             strcpy (headerb," 9. \0");
  248.             strcpy (databline,b9SInfo.Buffer);
  249.            break;
  250.           case 10:
  251.             strcpy (headera,"10. \0");
  252.             strcpy (dataline,a10SInfo.Buffer);
  253.             strcpy (headerb,"10. \0");
  254.             strcpy (databline,b10SInfo.Buffer);
  255.            break;
  256.           case 11:
  257.             strcpy (headera,"11. \0");
  258.             strcpy (dataline,a11SInfo.Buffer);
  259.             strcpy (headerb,"11. \0");
  260.             strcpy (databline,b11SInfo.Buffer);
  261.            break;
  262.           case 12:
  263.             strcpy (headera,"12. \0");
  264.             strcpy (dataline,a12SInfo.Buffer);
  265.             strcpy (headerb,"12. \0");
  266.             strcpy (databline,b12SInfo.Buffer);
  267.            break;
  268.        }
  269.       if (strlen(dataline) != 0)
  270.       {
  271.       strcat (outstr, headera);
  272.       strcat (outstr, dataline);
  273.       }
  274.        else
  275.          strcat (outstr,"    \0");
  276.       for (counter = 0; counter < (28-strlen(dataline)); counter++)
  277.          strcat (outstr, " \0");
  278.       if (strlen(databline) != 0)
  279.       {
  280.         strcat (outstr, headerb);
  281.         strcat (outstr, databline);
  282.       }
  283.       else
  284.         strcat (outstr,"    \0");      
  285.       for (counter = 0; counter < (28-strlen(databline)); counter++)
  286.          strcat (outstr, " \0");
  287.       strcat (outstr,"|\n\0");
  288.       fputs (outstr, fp);
  289.      }
  290.       fputs (blankline,fp);
  291.       fputs (halffeed,fp);
  292.       outstr[0] = '\0';
  293.       strcat (outstr,normal);
  294.       strcat (outstr,"   \0");
  295.       strcat (outstr,sideaSInfo.Buffer);
  296.       strcat (outstr,"\n\0");
  297.       fputs (outstr,fp);
  298.       outstr[0] = '\0';
  299.       strcat (outstr,normal);
  300.       strcat (outstr,"   \0");
  301.       strcat (outstr,sidebSInfo.Buffer);
  302.       strcat (outstr,"\n\0");
  303.       fputs (outstr,fp);
  304.       fputs (condensed,fp);
  305.       fputs (halffeed,fp);
  306.       fputs (blankline,fp);
  307.       fputs (blankline,fp);
  308.       fputs (blankline,fp);
  309.       fputs ("-------------------------------------------------------------------\n\0",fp);
  310.       fputs (normal,fp);
  311.       fputc(FF,fp);
  312.       fclose (fp);
  313.    }
  314. }
  315. struct Gadget FindGad(num)
  316. int  num;
  317. {
  318.    struct Gadget tempgad;
  319.    switch (num)
  320.     {
  321.        case 0:
  322.            tempgad = a1;
  323.            break;
  324.        case 1:
  325.            tempgad = a2;
  326.            break;
  327.        case 2:
  328.            tempgad = a3;
  329.            break;
  330.        case 3:
  331.            tempgad = a4;
  332.            break;
  333.        case 4:
  334.            tempgad = a5;
  335.            break;
  336.        case 5:
  337.            tempgad = a6;
  338.            break;
  339.        case 6:
  340.            tempgad = a7;
  341.            break;
  342.        case 7:
  343.            tempgad = a8;
  344.            break;
  345.        case 8:
  346.            tempgad = a9;
  347.            break;
  348.        case 9:
  349.            tempgad = a10;
  350.            break;
  351.        case 10:
  352.            tempgad = a11;
  353.            break;
  354.        case 11:
  355.            tempgad = a12;
  356.            break;
  357.     }
  358.    return (tempgad);
  359. }
  360.  
  361. struct Gadget FindBGad(num)
  362. int  num;
  363. {
  364.    struct Gadget tempgad;
  365.    switch (num)
  366.     {
  367.        case 0:
  368.            tempgad = b1;
  369.            break;
  370.        case 1:
  371.            tempgad = b2;
  372.            break;
  373.        case 2:
  374.            tempgad = b3;
  375.            break;
  376.        case 3:
  377.            tempgad = b4;
  378.            break;
  379.        case 4:
  380.            tempgad = b5;
  381.            break;
  382.        case 5:
  383.            tempgad = b6;
  384.            break;
  385.        case 6:
  386.            tempgad = b7;
  387.            break;
  388.        case 7:
  389.            tempgad = b8;
  390.            break;
  391.        case 8:
  392.            tempgad = b9;
  393.            break;
  394.        case 9:
  395.            tempgad = b10;
  396.            break;
  397.        case 10:
  398.            tempgad = b11;
  399.            break;
  400.        case 11:
  401.            tempgad = b12;
  402.            break;
  403.     }
  404.    return (tempgad);
  405. }
  406.  
  407. VOID SaveTape ()
  408. {
  409.    strcpy (TapeList[currtape].aname, sideaSIBuff);
  410.    strcpy (TapeList[currtape].ItemAName[0], a1SIBuff);
  411.    strcpy (TapeList[currtape].ItemAName[1], a2SIBuff);
  412.    strcpy (TapeList[currtape].ItemAName[2], a3SIBuff);
  413.    strcpy (TapeList[currtape].ItemAName[3], a4SIBuff);
  414.    strcpy (TapeList[currtape].ItemAName[4], a5SIBuff);
  415.    strcpy (TapeList[currtape].ItemAName[5], a6SIBuff);
  416.    strcpy (TapeList[currtape].ItemAName[6], a7SIBuff);
  417.    strcpy (TapeList[currtape].ItemAName[7], a8SIBuff);
  418.    strcpy (TapeList[currtape].ItemAName[8], a9SIBuff);
  419.    strcpy (TapeList[currtape].ItemAName[9], a10SIBuff);
  420.    strcpy (TapeList[currtape].ItemAName[10], a11SIBuff);
  421.    strcpy (TapeList[currtape].ItemAName[11], a12SIBuff);
  422.    strcpy (TapeList[currtape].bname, sidebSIBuff);
  423.    strcpy (TapeList[currtape].ItemBName[0], b1SIBuff);
  424.    strcpy (TapeList[currtape].ItemBName[1], b2SIBuff);
  425.    strcpy (TapeList[currtape].ItemBName[2], b3SIBuff);
  426.    strcpy (TapeList[currtape].ItemBName[3], b4SIBuff);
  427.    strcpy (TapeList[currtape].ItemBName[4], b5SIBuff);
  428.    strcpy (TapeList[currtape].ItemBName[5], b6SIBuff);
  429.    strcpy (TapeList[currtape].ItemBName[6], b7SIBuff);
  430.    strcpy (TapeList[currtape].ItemBName[7], b8SIBuff);
  431.    strcpy (TapeList[currtape].ItemBName[8], b9SIBuff);
  432.    strcpy (TapeList[currtape].ItemBName[9], b10SIBuff);
  433.    strcpy (TapeList[currtape].ItemBName[10], b11SIBuff);
  434.    strcpy (TapeList[currtape].ItemBName[11], b12SIBuff);
  435. }
  436.  
  437. VOID DisplayTape()
  438. {
  439.    strcpy (sideaSIBuff,TapeList[currtape].aname);
  440.    strcpy (a1SIBuff,TapeList[currtape].ItemAName[0]);
  441.    strcpy (a2SIBuff,TapeList[currtape].ItemAName[1]);
  442.    strcpy (a3SIBuff,TapeList[currtape].ItemAName[2]);
  443.    strcpy (a4SIBuff,TapeList[currtape].ItemAName[3]);
  444.    strcpy (a5SIBuff,TapeList[currtape].ItemAName[4]);
  445.    strcpy (a6SIBuff,TapeList[currtape].ItemAName[5]);
  446.    strcpy (a7SIBuff,TapeList[currtape].ItemAName[6]);
  447.    strcpy (a8SIBuff,TapeList[currtape].ItemAName[7]);
  448.    strcpy (a9SIBuff,TapeList[currtape].ItemAName[8]);
  449.    strcpy (a10SIBuff,TapeList[currtape].ItemAName[9]);
  450.    strcpy (a11SIBuff,TapeList[currtape].ItemAName[10]);
  451.    strcpy (a12SIBuff,TapeList[currtape].ItemAName[11]);
  452.    strcpy (sidebSIBuff,TapeList[currtape].bname);
  453.    strcpy (b1SIBuff,TapeList[currtape].ItemBName[0]);
  454.    strcpy (b2SIBuff,TapeList[currtape].ItemBName[1]);
  455.    strcpy (b3SIBuff,TapeList[currtape].ItemBName[2]);
  456.    strcpy (b4SIBuff,TapeList[currtape].ItemBName[3]);
  457.    strcpy (b5SIBuff,TapeList[currtape].ItemBName[4]);
  458.    strcpy (b6SIBuff,TapeList[currtape].ItemBName[5]);
  459.    strcpy (b7SIBuff,TapeList[currtape].ItemBName[6]);
  460.    strcpy (b8SIBuff,TapeList[currtape].ItemBName[7]);
  461.    strcpy (b9SIBuff,TapeList[currtape].ItemBName[8]);
  462.    strcpy (b10SIBuff,TapeList[currtape].ItemBName[9]);
  463.    strcpy (b11SIBuff,TapeList[currtape].ItemBName[10]);
  464.    strcpy (b12SIBuff,TapeList[currtape].ItemBName[11]);
  465.    RefreshGList(&sidea,window1,NULL,32);
  466. }
  467.  
  468. VOID DeleteTape()
  469. {
  470.    int counter;
  471.    for (counter = currtape; counter < numtapes; counter++)   
  472.        TapeList[counter] = TapeList[counter+1];
  473.    TapeList[numtapes].aname[0] = '\0';
  474.    TapeList[numtapes].bname[0] = '\0';
  475.    for (counter = 0; counter <= 11; counter++)
  476.    {
  477.        TapeList[numtapes].ItemAName[counter][0] = '\0';
  478.        TapeList[numtapes].ItemBName[counter][0] = '\0';
  479.    } 
  480.    numtapes--;
  481.    if (numtapes < currtape)
  482.         currtape = numtapes;
  483. }
  484.  
  485.  
  486. VOID StoreTape()
  487. {
  488.    FILE *fopen(), *hs;
  489.    int counter = 0, count2;
  490.       if ((hs = fopen("TapeCover.file", "w")) != NULL) {
  491.       for (counter = 0; counter <= numtapes; counter++)
  492.       {
  493.     fputs(TapeList[counter].aname,hs);
  494.         fputs ("\n",hs);
  495.         fputs(TapeList[counter].bname,hs);
  496.         fputs ("\n",hs);
  497.         for (count2 = 0; count2 < 12; count2++) 
  498.          {
  499.            fputs(TapeList[counter].ItemAName[count2],hs);
  500.            fputs("\n",hs);
  501.            fputs(TapeList[counter].ItemBName[count2],hs);
  502.            fputs("\n",hs); 
  503.          }   
  504.      }
  505.         fflush(hs);
  506.     fclose(hs);
  507.     }
  508. }
  509.  
  510. VOID 
  511. main()
  512. {
  513.     struct Gadget tempgad, tempgad2;
  514.     short dolby, changed = 0;
  515.     ULONG           signalmask, signals;
  516.     OpenAll();    
  517.     DisplayTape();
  518.     signalmask = 1L << window1->UserPort->mp_SigBit;
  519.     ActivateGadget(&sidea,window1,NULL);
  520.     while (GadFlag != CLOSED)
  521.    {
  522.     signals = Wait(signalmask);
  523.     GadFlag = handleIDCMP(window1);
  524.     if (down == 0)
  525.     {
  526.     if ((direction == 1) && (currtape < numtapes))
  527.     {
  528.         currtape++;
  529.         DisplayTape();
  530.     }
  531.     else if ((direction == -1) && (currtape > 0))
  532.     {
  533.         currtape--;
  534.         DisplayTape();
  535.     } else
  536.     switch (GadFlag)
  537.     {
  538.       case PRINTGAD: 
  539.            PrintRoutine();
  540.            break;
  541.       case DOLBYGAD:
  542.            if (dolby == 0)
  543.                 dolby = 1;
  544.                else dolby = 0;
  545.            break;
  546.       case FORWARDGAD:
  547.            if (changed == 1)
  548.               {
  549.                 changed = 0;
  550.                 SaveTape();
  551.               }
  552.            if (currtape < numtapes)
  553.            {
  554.               currtape++;
  555.               DisplayTape();
  556.            }
  557.            break;
  558.       case BACKGAD:
  559.            if (changed == 1)
  560.            {
  561.              changed = 0;
  562.              SaveTape();
  563.            }  
  564.             if (currtape > 0)
  565.            {
  566.                  currtape--;
  567.             DisplayTape();
  568.            }
  569.            break;
  570.       case NEWGAD:
  571.            if (changed == 1)
  572.            {
  573.               changed = 0;
  574.               SaveTape();
  575.            }
  576.            numtapes++;
  577.            currtape = numtapes;
  578.            DisplayTape();
  579.            ActivateGadget(&sidea,window1,NULL);
  580.            break;
  581.       case DELGAD:
  582.            if (changed == 1)
  583.              changed = 0;
  584.            DeleteTape();
  585.            if (numtapes < 0)
  586.            {
  587.              numtapes++;
  588.              currtape++;
  589.            }
  590.            DisplayTape();
  591.            break;
  592.       case CLEARMENU:
  593.            while (numtapes != -1)
  594.               DeleteTape();
  595.            numtapes = 0;
  596.            currtape = 0;
  597.            DisplayTape();
  598.            break;
  599.       case SAVEMENU:
  600.            if (changed == 1)
  601.            { 
  602.             changed = 0;
  603.             SaveTape();
  604.            }
  605.            StoreTape();
  606.            break;
  607.  
  608.     }
  609.     }
  610.     else
  611.       switch (GadFlag)
  612.     {
  613.        case FFORWARDGAD:
  614.            if (changed == 1)
  615.            {
  616.              changed = 0;
  617.              SaveTape();
  618.            }  
  619.              direction = 1;
  620.              down =0;
  621.              break;
  622.        case REWINDGAD:
  623.            if (changed == 1)
  624.            {
  625.              changed = 0;
  626.              SaveTape();
  627.            }  
  628.              direction = -1;
  629.              down = 0;
  630.              break;
  631.      }
  632.     if ((GadFlag >= SIDEAGAD) && (GadFlag <= SIDEAGAD+12))
  633. {
  634.     changed = 1;
  635.     tempgad = FindGad (GadFlag - SIDEAGAD);
  636.     ActivateGadget(&tempgad,window1,NULL);
  637. }
  638.  else
  639.     if ((GadFlag >= SIDEBGAD) && (GadFlag <= SIDEBGAD+12))
  640. {
  641.     changed = 1;
  642.     tempgad = FindBGad (GadFlag - SIDEBGAD);
  643.     ActivateGadget(&tempgad,window1,NULL);
  644. }
  645.    }
  646.     cleanExit(window1, RETURN_OK);
  647. }
  648.